Added validation rule for apiMethod parameter in getTreemapData API call, #AS-494#72
Added validation rule for apiMethod parameter in getTreemapData API call, #AS-494#72AltamashShaikh merged 8 commits into5.x-devfrom
Conversation
sgiehl
left a comment
There was a problem hiding this comment.
Only roughly looked through code. Haven't done any testing.
API.php
Outdated
| list($apiName, $apiAction) = explode('.', $apiMethod); | ||
| $disAllowedApiActions = ['getBulkRequest']; | ||
| // Block if API action does not start with get | ||
| if (!in_array($apiAction, $disAllowedApiActions) || stripos($apiAction, 'get') !== 0) { |
There was a problem hiding this comment.
That first ! is incorrect right?
Some quick functional tests would catch & clarify this.
lachiebol
left a comment
There was a problem hiding this comment.
LGTM, getBulkRequest & anything that doesn't start with get is returning an error
james-hill-matomo
left a comment
There was a problem hiding this comment.
Tested in dev and it still worked OK.
Applying CSRF protections would be nice. I manually tested the correct methods are blocked.
19b180b
@james-hill-matomo CSRF for API ? Can you explain a bit ? |
|
@james-hill-matomo Your approval is needed to merge the code. |
Description
Added validation rule for apiMethod parameter in getTreemapData API call
Issue No
#AS-494
Steps to Replicate the Issue
Checklist